package com.coincalf.mapper;

import com.coincalf.entity.ForexAccount;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * 创新交易持仓信息 Mapper 接口
 * </p>
 *
 * @author qiang
 * @since 2018-05-12
 */
public interface ForexAccountMapper extends BaseMapper<ForexAccount> {

    /**
     * 冻结持仓
     * @param accountId 资金账户ID
     * @param amount 冻结金额
     * @return
     */
    int lockAmount(@Param("accountId") long accountId, @Param("amount") BigDecimal amount);

    /**
     * 解冻持仓
     * @param accountId 资金账户ID
     * @param amount 解冻金额
     * @return
     */
    int unlockAmount(@Param("accountId") long accountId, @Param("amount") BigDecimal amount);

    /**
     * 持仓汇总
     * @param userId 用户ID
     * @return
     */
    List<ForexAccount> positionSummary(@Param("userId") Long userId);
}
